<!-- 评论片段模板 -->
<div class="comment-item mb-4 pb-3 border-bottom" id="comment-{{ comment.id }}">
    <div class="d-flex">
        <img src="{{ comment.author.avatar_url or url_for('static', filename='images/default-avatar.png') }}" 
             class="rounded-circle me-3" width="40" height="40" alt="头像">
        <div class="flex-grow-1">
            <div class="d-flex justify-content-between align-items-start mb-2">
                <div>
                    <strong>{{ comment.author.username }}</strong>
                    <span class="text-muted small ms-2">{{ comment.created_at|relative_time }}</span>
                </div>
                {% if current_user.is_authenticated and (current_user.id == comment.author_id or current_user.is_admin) %}
                <button class="btn btn-sm btn-outline-danger delete-comment-btn" 
                        data-comment-id="{{ comment.id }}">
                    <i class="fas fa-trash"></i>
                </button>
                {% endif %}
            </div>
            <div class="comment-content">
                {{ comment.content|safe }}
            </div>
        </div>
    </div>
</div>